package main

import (
	"fmt"
	"time"
)

// switch的用法感觉跟其他语言也没啥区别，跟java比就是不用在每个case末尾加上break
func main() {
	t := time.Now()
	hour := t.Hour()
	switch {
	case hour < 12:
		fmt.Println("good morning")
	case hour > 12:
		fmt.Println("good noon")
	default:
		fmt.Println("nothing")
	}

	whatType := func(u interface{}) {
		switch u.(type) {
		case bool:
			fmt.Println("u is bool")
		case int:
			fmt.Println("u is int")
		default:
			fmt.Println("i donot know type")

		}
	}

	whatType(true)
	whatType(111)
	whatType(6.666)
}
